/*
 *
 *  * Copyright 2019-2020 the original author or authors.
 *  *
 *  * Licensed under the Apache License, Version 2.0 (the "License");
 *  * you may not use this file except in compliance with the License.
 *  * You may obtain a copy of the License at
 *  *
 *  *      https://www.apache.org/licenses/LICENSE-2.0
 *  *
 *  * Unless required by applicable law or agreed to in writing, software
 *  * distributed under the License is distributed on an "AS IS" BASIS,
 *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  * See the License for the specific language governing permissions and
 *  * limitations under the License.
 *
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.0.0).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
package org.wapache.openapi.spring.webmvc.demo.api;

import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import org.wapache.openapi.spring.core.converters.models.PageableAsQueryParam;
import org.wapache.openapi.spring.webmvc.annotation.DeleteOperation;
import org.wapache.openapi.spring.webmvc.annotation.GetOperation;
import org.wapache.openapi.spring.webmvc.annotation.PostOperation;
import org.wapache.openapi.spring.webmvc.annotation.PutOperation;
import org.wapache.openapi.spring.webmvc.demo.model.ModelApiResponse;
import org.wapache.openapi.spring.webmvc.demo.model.Pet;
import org.wapache.openapi.v3.annotations.Operation;
import org.wapache.openapi.v3.annotations.Parameter;
import org.wapache.openapi.v3.annotations.enums.Explode;
import org.wapache.openapi.v3.annotations.enums.ParameterIn;
import org.wapache.openapi.v3.annotations.enums.ParameterStyle;
import org.wapache.openapi.v3.annotations.enums.SecuritySchemeType;
import org.wapache.openapi.v3.annotations.media.ArraySchema;
import org.wapache.openapi.v3.annotations.media.Content;
import org.wapache.openapi.v3.annotations.media.Schema;
import org.wapache.openapi.v3.annotations.parameters.ApiRequestBody;
import org.wapache.openapi.v3.annotations.responses.ApiResponse;
import org.wapache.openapi.v3.annotations.responses.ApiResponses;
import org.wapache.openapi.v3.annotations.security.OAuthFlow;
import org.wapache.openapi.v3.annotations.security.OAuthFlows;
import org.wapache.openapi.v3.annotations.security.OAuthScope;
import org.wapache.openapi.v3.annotations.security.SecurityRequirement;
import org.wapache.openapi.v3.annotations.security.SecurityScheme;
import org.wapache.openapi.v3.annotations.tags.Tag;

import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

@SecurityScheme(
	name = "petstore_auth",
	type = SecuritySchemeType.OAUTH2,
	flows = @OAuthFlows( implicit = @OAuthFlow(
		authorizationUrl = "https://petstore3.swagger.io/oauth/authorize",
		scopes = {
			@OAuthScope(name = "write:pets", description = "修改你的宠物"),
			@OAuthScope(name = "read:pets", description = "读取你的宠物列表")
		}
	))
)
@Tag(name = "pet", title = "宠物接口", description = "宠物相关接口")
public interface PetApi {

	default PetApiDelegate getDelegate() {
		return new PetApiDelegate() {
		};
	}

	@PostOperation(
		title = "添加一只宠物到宠物商店",
		description = "",
		path = "/pet",
		consumes = { "application/json", "application/xml", "application/x-www-form-urlencoded" },
		produces = { "application/json", "application/xml" },
		parameters = {
		},
		requestBody = @ApiRequestBody(
			title = "宠物信息",
			description = "",
			content = {
				@Content(mediaType = "application/xml", schema = @Schema(implementation = Pet.class, required = true)),
				@Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class))
			}
		),
		responses = {
			@ApiResponse(responseCode = "200", description = "操作成功", content = {
				@Content(mediaType = "application/xml", schema = @Schema(implementation = Pet.class)),
				@Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class))
			}),
			@ApiResponse(responseCode = "405", description = "非法的输入")
		},
		security = {
			@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
		}
	)
	default ResponseEntity<Pet> addPet(@Valid @RequestBody Pet pet) {
		return getDelegate().addPet(pet);
	}

	@DeleteOperation(
		title = "删除宠物",
		description = "根据宠物ID删除一只宠物。",
		path = "/pet/{petId}",
		parameters = {
			@Parameter(in=ParameterIn.HEADER, name="api_key", description = ""),
			@Parameter(in=ParameterIn.PATH, name="petId", description = "宠物ID", required = true)
		},
		responses = {
			@ApiResponse(responseCode = "400", description = "非法的宠物ID")
		},
		security = {
			@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
		}
	)
	default ResponseEntity<Void> deletePet(
		@PathVariable
		Long petId,
		@RequestHeader(value = "api_key", required = false)
		String apiKey
	) {
		return getDelegate().deletePet(petId, apiKey);
	}

	@PutOperation(
		title = "修改宠物信息",
		description = "",
		operationId = "updatePet",
		path = "/pet",
		consumes = { "application/json", "application/xml", "application/x-www-form-urlencoded" },
		requestBody = @ApiRequestBody(
			title = "宠物信息",
			description = "",
			content = {
				@Content(mediaType = "application/xml", schema = @Schema(implementation = Pet.class, required = true)),
				@Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class))
			}
		),
		responses = {
			@ApiResponse(responseCode = "200", description = "操作成功",
				content = {
					@Content(mediaType = "application/xml", schema = @Schema(implementation = Pet.class)),
					@Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class))
				}
			),
			@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
			@ApiResponse(responseCode = "404", description = "Pet not found"),
			@ApiResponse(responseCode = "405", description = "Validation exception")
		},
		security = {
			@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
		}
	)
	default ResponseEntity<Void> updatePet(@Valid @RequestBody Pet pet) {
		return getDelegate().updatePet(pet);
	}

	@PostOperation(
		title = "修改宠物信息(form表单形式)",
		description = "",
		path = "/pet/{petId}",
		consumes = { "application/x-www-form-urlencoded" },
		parameters = {
			@Parameter(name = "petId", title = "宠物ID", description = "", required = true),
			@Parameter(name = "name", title = "宠物名称", description = ""),
			@Parameter(name = "status", title = "宠物状态", description = "")
		},
		responses = {
			@ApiResponse(responseCode = "405", description = "非法的输入")
		},
		security = {
			@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
		},
		tags = { "pet" }
	)
	default ResponseEntity<Void> updatePetWithForm(
		 @PathVariable Long petId,
		 @RequestParam(required = false) String name,
		 @RequestParam(required = false) String status
	) {
		return getDelegate().updatePetWithForm(petId, name, status);
	}

	@PostOperation(
		title = "上传图片",
		path = "/pet/{petId}/uploadImage",
		consumes = { "application/octet-stream" },
		produces = { "application/json" },
		parameters = {
			@Parameter(name = "petId", title = "宠物ID", description = "", required = true),
			@Parameter(name = "additionalMetadata", title = "宠物扩展信息", description = "")
		},
		requestBody = @ApiRequestBody(content = {
			@Content(mediaType = "application/octet-stream", schema = @Schema(type = "string", format = "binary"))
		}),
		responses = {
			@ApiResponse(responseCode = "200", description = "操作成功",
				content = @Content(schema = @Schema(implementation = ModelApiResponse.class))
			)
		},
		security = {
			@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
		}
	)
	default ResponseEntity<ModelApiResponse> uploadFile(
		@PathVariable("petId") Long petId,
		@RequestParam(value = "additionalMetadata", required = false) String additionalMetadata,
		@Valid @RequestPart("file") MultipartFile file
	) {
		return getDelegate().uploadFile(petId, additionalMetadata, file);
	}

	@GetOperation(
		title = "分页查询宠物",
		description = "",
		path = "/pet",
		produces = { "application/json", "application/xml" },
		responses = {
			@ApiResponse(responseCode = "200", description = "操作成功",
				content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))
			)
		},
		security = {
			@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
		}
	)
	@PageableAsQueryParam
	default ResponseEntity<List<Pet>> getAllPets(
		// @PageableDefault(sort = {"name"}, direction = Sort.Direction.ASC)
		@NotNull Pageable pageable
	) {
		return getDelegate().getAllPets(pageable);
	}

	@GetOperation(
		title = "根据ID获取宠物信息",
		description = "",
		path = "/pet/{petId}",
		produces = { "application/json", "application/xml" },
		parameters = {
			@Parameter(in = ParameterIn.PATH, name = "petId", title="宠物ID", description = "", required = true)
		},
		responses = {
			@ApiResponse(responseCode = "200", description = "操作成功, 返回宠物信息",
				content = @Content(schema = @Schema(implementation = Pet.class))
			),
			@ApiResponse(responseCode = "400", description = "宠物ID不正确", content = @Content),
			@ApiResponse(responseCode = "404", description = "找不到该宠物", content = @Content)
		},
		security = {
			@SecurityRequirement(name = "api_key"),
			@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
		}
	)
	default ResponseEntity<Pet> getPetById( @PathVariable Long petId) {
		return getDelegate().getPetById(petId);
	}

	@GetOperation(
		title = "根据状态查找宠物",
		description = "",
		path = "/pet/findByStatus",
		produces = { "application/json", "application/xml" },
		parameters = {
			@Parameter(
				in = ParameterIn.QUERY,
				name = "status",
				title = "宠物状态",
				description = "多个状态可以用逗号分隔",
				explode = Explode.TRUE,
				style = ParameterStyle.FORM,
				schema = @Schema(
					type = "string",
					title = "",
					defaultValue = "available",
					allowableValues = { "available", "pending", "sold" }
				)
			)
		},
		responses = {
			@ApiResponse(
				responseCode = "200",
				description = "操作成功",
				content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))
			),
			@ApiResponse(responseCode = "400", description = "非法的宠物状态值")
		},
		security = {
			@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
		}
	)
	default ResponseEntity<List<Pet>> findPetsByStatus(
		@Valid
		@RequestParam(value = "status", required = false, defaultValue = "available")
			List<String> status
	) {
		return getDelegate().findPetsByStatus(status);
	}

	@GetOperation(
		title = "根据标签查找宠物",
		description = "",
		path = "/pet/findByTags",
		produces = { "application/json", "application/xml" },
		parameters = {
			@Parameter(
				in = ParameterIn.QUERY,
				name = "tags",
				description = "多个tag用逗号分隔, 譬如tag1, tag2, tag3",
				explode = Explode.TRUE,
				style = ParameterStyle.FORM
			)
		},
		responses = {
			@ApiResponse(responseCode = "200", description = "操作成功",
				content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))
			),
			@ApiResponse(responseCode = "400", description = "Invalid tag value", content = @Content)
		},
		security = {
			@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
		}
	)
	default ResponseEntity<List<Pet>> findPetsByTags(
		@Valid @RequestParam(value = "tags", required = false) List<String> tags
	) {
		return getDelegate().findPetsByTags(tags);
	}

}
